import { ElNotification } from "element-plus";
import { $del, $post ,$put,$get } from "../utils/requst";

//轮播图列表
export const $SlideshowList = async (params:object)=>{
    let ret = await $get('/system/slideshow/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//轮播图新增
export const $SlideshowAdd = async (params:object)=>{
    let ret = await $post('/system/slideshow/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//轮播图编辑
export const $SlideshowEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/slideshow/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//轮播图删除
export const $SlideshowDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/slideshow/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//公司查询
export const $CompanyInfo = async (params:object)=>{
    let ret = await $get('/system/company/companyInfo',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//公司编辑
export const $CompanyEdit = async (params:object)=>{
    let ret = await $put('/system/company/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//用户质询列表
export const $WechatList = async (params:object)=>{
    let ret = await $get('/system/wechat/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//用户质询新增
export const $WechatAdd = async (params:object)=>{
    let ret = await $post('/system/wechat/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//用户质询编辑
export const $WechatEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/wechat/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//用户质询删除
export const $WechatDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/wechat/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//用户列表
export const $UserList = async (params:object)=>{
    let ret = await $get('/system/user/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}